package com.alipay.config;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import edu.ustb.mapper.OrderMapper;
import edu.ustb.utils.MybatisUtil;

/**
 * Servlet implementation class AlipayController
 */
@WebServlet("/alipay.do")
public class AlipayController extends HttpServlet {
	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String orderId = request.getParameter("orderId");
		OrderMapper mapper = MybatisUtil.getMapper(OrderMapper.class);
		request.setAttribute("order", mapper.findOrderById(orderId));
		request.getRequestDispatcher("Cart-pay.jsp").forward(request, response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
